/*
 * IndexGUI.java
 *
 * Created on Oct 29, 2010, 2:30:33 PM
 */
package br.ic.ufal.view;

import br.ufal.ic.user.User;
import javax.swing.JFrame;

/**
 * Janela grafica que contera informações de um usuario especifico.
 * 
 * @author Marcos Paulo
 */
public class UserGUI extends javax.swing.JFrame {

    private User user;
    private TimeGUI timeGUI;
    private TournamentGUI tournamentGUI;

    /** Creates new form IndexGUI */
    public UserGUI(User user) {

        this.user = user;
        initComponents();
        setTitle("Bem vindo " + user.getInformation().getName() + "!");


        timeGUI = new TimeGUI(user);
        timeGUI.setVisible(false);
        timeGUI.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        tournamentGUI = new TournamentGUI(user);
        tournamentGUI.setVisible(false);
        tournamentGUI.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        timeMenuItem = new javax.swing.JMenuItem();
        tournamentMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Bem vindo!");

        jMenu1.setText("Menu");

        timeMenuItem.setText("Tempos");
        timeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                timeMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(timeMenuItem);

        tournamentMenuItem.setText("Torneios");
        tournamentMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tournamentMenuItemActionPerformed(evt);
            }
        });
        jMenu1.add(tournamentMenuItem);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 258, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-315)/2, 416, 315);
    }// </editor-fold>//GEN-END:initComponents

    private void timeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeMenuItemActionPerformed
        timeGUI.setVisible(true);
    }//GEN-LAST:event_timeMenuItemActionPerformed

    private void tournamentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tournamentMenuItemActionPerformed
        tournamentGUI.setVisible(true);
    }//GEN-LAST:event_tournamentMenuItemActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem timeMenuItem;
    private javax.swing.JMenuItem tournamentMenuItem;
    // End of variables declaration//GEN-END:variables
}
